﻿using System;
using System.Collections.Generic;

namespace InDepth2Demo.Chapter8
{
    /// <summary>
    /// 用智能的编译器来防错
    /// </summary>
    public class AutoProperties
    {
        // 8.1 自动实现的属性
        public string Name { get; set; }

        //被编译为：
        //private string <Name>k__BackingField;
        //public string Name
        //{
        //    get { return <Name> k__BackingField; }
        //    set { <Name> k__BackingField = value; }
        //}

        public void VarTest()
        {
            var stringVariable = "Hello, World";        // 变量仍是静态类型的。

            var namePeopleMap = new Dictionary<string, List<string>>();     // var的智能提示为： class System.Collections.Generic.Dictionary<Tkey, TValue>

            Console.WriteLine(namePeopleMap.Count);
            Console.WriteLine(stringVariable);
        }
    }
}
